package com.ilop.sthome.ui.activity.config;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.example.common.base.BaseBindActivity;
import com.ilop.sthome.data.bean.QuestionBean;
import com.ilop.sthome.ui.adapter.config.QuestionAdapter;
import com.siterwell.familywellplus.R;
import com.siterwell.familywellplus.databinding.ActivityQuestionBinding;

import java.util.ArrayList;
import java.util.List;

/**
 * @author skygge
 * @date 2019/10/27.
 * GitHub：javofxu@github.com
 * email：skygge@yeah.net
 * description：配网失败
 */
public class QuestionActivity extends BaseBindActivity<ActivityQuestionBinding> {
    private List<QuestionBean> mQuestionList;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_question;
    }

    @Override
    protected void initView() {
        super.initView();
        mQuestionList = new ArrayList<>();
        mDBind.questionList.setLayoutManager(new LinearLayoutManager(mContext));
    }

    @Override
    protected void initData() {
        super.initData();
        String[] ques = {getString(R.string.distribution_network_mode),
                getString(R.string.wifi_password_error),
                getString(R.string.wifi_24ghz),
                getString(R.string.space_problem),
                getString(R.string.mobile_ap_distribution_network)};

        String[] answer = {getString(R.string.failed_Esptouch_check_eq),
                getString(R.string.wifi_password_may_be_wrong),
                getString(R.string.this_product_only_supports_24ghz),
                getString(R.string.router_may_contain_spaces),
                getString(R.string.make_sure_the_hotspot_name_is_aha)};
        for(int i=0; i<ques.length; i++){
            QuestionBean questionBean = new QuestionBean();
            questionBean.setAnswer(answer[i]);
            questionBean.setQuestion(ques[i]);
            mQuestionList.add(questionBean);
        }
        QuestionAdapter mAdapter = new QuestionAdapter(this, mQuestionList);
        mDBind.questionList.setAdapter(mAdapter);
    }

    @Override
    protected void initListener() {
        super.initListener();
        mDBind.ivConfigFailBack.setOnClickListener(view -> finish());
    }

}
